package my.edu.model.information.entity.dto;

import jakarta.validation.constraints.*;
import jakarta.validation.groups.Default;
import lombok.Data;
import my.edu.common.validate.groups.Insert;
import my.edu.common.validate.IntegerPattern;

import java.math.BigDecimal;

@Data
public class AccountSaveDTO {
    @Null(message = "id必须为空",groups = Insert.class)
    @NotNull(message = "id不能为空" ,groups = { Default.class})
    private Long id;
    @NotBlank(message = "账户编号不能为空", groups = {Insert.class, Default.class})//不能为null，也不能为空
    private String accountNo;
    @NotBlank(message = "账户姓名不能为空", groups = {Insert.class, Default.class})
    private String accountName;
    @Min( value = 0,message = "余额必须为正数")
    private BigDecimal initialBalance;//期初余额
    @NotBlank(message = "账户类型不能为空", groups = {Insert.class, Default.class})
    private String accountType;
    @IntegerPattern(regexp = "^[01]$", message = "是否默认账户参数错误", groups = {Insert.class, Default.class})
    @NotNull(message = "是否默认账户不能为空", groups = {Insert.class, Default.class})
    private Integer isDefaultAccount;
    @IntegerPattern(regexp = "^[01]$", message = "状态参数错误", groups = {Insert.class, Default.class})
    private Integer status;


    public AccountSaveDTO(){
        this.isDefaultAccount=0;
        this.initialBalance=new BigDecimal(0);
    }


}
